import { createRouter, createWebHistory } from "vue-router";
import Layout from "../views/LayoutView.vue";
import Login from "@/views/LoginView.vue";
import Reg from "@/views/RegView.vue";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/login",
      name: "login",
      component: Login,
    },
    {
      path: "/reg",
      name: "reg",
      component: Reg,
    },
    {
      path: "/",
      name: "layout",
      component: Layout,
      redirect: "/home",
      children: [
        {
          path: "/home",
          name: "home",
          component: () => import("../views/HomeView.vue"),
        },
        {
          path: "/me",
          name: "me",
          component: () => import("../views/MeView.vue"),
        },
      ],
    },
  ],
});

export default router;
